package com.literature.search.file.controller;

import com.literature.search.core.entity.R.AjaxJson;
import com.literature.search.core.entity.dto.BasePageDTO;
import com.literature.search.file.service.DownloadRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @ClassName DownloadRecordController
 * @Description TODO
 * @Author abin
 * @Date 2023/3/29 17:19
 * @Version 1.0
 */
@Api(tags = "用户下载记录管理")
@RestController
@RequestMapping("/downloadRecord")
public class DownloadRecordController {

    @Resource
    private DownloadRecordService downloadRecordService;

    @PostMapping("/findDownloadRecordByUserId")
    @ApiOperation(value = "用户查看自己的下载记录",notes = "用户查看自己的下载记录")
    public AjaxJson findDownloadRecordByUserId(@ModelAttribute("pageParams") @Valid BasePageDTO page){
        return downloadRecordService.findDownloadRecordByUserId(page);
    }

    @PostMapping("/deleteDownloadRecordById")
    @ApiOperation(value = "用户删除下载记录",notes = "用户删除自己的下载记录")
    public AjaxJson deleteDownloadRecordById(String id){
        return downloadRecordService.deleteDownloadRecordById(id);
    }
}
